import sys
import CppHeaderParser
import json

from CppHeaderParser.CppHeaderParser import CppHeader
from s2r import from_struct,define,type_converter,alias
try:
    cppHeader = CppHeaderParser.CppHeader(sys.argv[1])
except CppHeaderParser.CppParseError as e:
    print(e)
    sys.exit(1)
for d in cppHeader.defines:
    define(d)
for v in cppHeader.variables:
    alias(v)
type_converter.rust()
for name in cppHeader.classes:
    s = from_struct(cppHeader.classes[name])
    s.rust()

for n in cppHeader.classes:
    print(n)

